package Text;


class Anamial1{
    String name;
    int age;

    public void eat(){
        System.out.println(this.name+" 吃饭");
    }

    /*public void sleep(){
        System.out.println(this.name+" 想要睡觉");
    }
     */
}

class Cat1 extends Anamial1{
    public void eat(){
        System.out.println(this.name+" 吃猫粮");
    }

}

class Dog1 extends Anamial1{
    public void eat(){
        System.out.println(this.name+" 吃狗粮");
    }
}

public class TextDemo3 {
    public static void func(Anamial1 anamial){
        anamial.eat();
    }

    public static void main(String[] args) {
        Cat1 cat = new Cat1();
        Dog1 dog = new Dog1();
        cat.name = "咪咪";
        dog.name = "大黄";
        func(cat);
        func(dog);
    }

    public static void main1(String[] args) {
    Anamial1 anamial = new Cat1();
    anamial.name = "mimi";
    anamial.eat();
    }
}
